package com.easy.dfcapi.service.impl;

import com.easy.common.bean.Result;
import com.easy.common.constant.EnumConfig;
import com.easy.common.util.Utility;
import com.easy.dfcapi.entity.ApiStore;
import com.easy.dfcapi.mapper.ApiOrderMapper;
import com.easy.dfcapi.mapper.ApiStoreMapper;
import com.easy.dfcapi.mapper.ApiUserMapper;
import com.easy.dfcapi.res.OrderInfoRes;
import com.easy.dfcapi.res.OrderRes;
import com.easy.dfcapi.res.Response;
import com.easy.dfcapi.res.UserRes;
import com.easy.dfcapi.service.ApiOrderService;
import com.easy.dfcapi.utils.ApiSessionUser;
import com.easy.dfcapi.utils.ServletHelper;
import com.easy.modules.sys.mapper.ParaMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * Created by VULCANTSeries on 2017/5/10.
 */
@Service
@Transactional(readOnly = true)
public class ApiOrderServiceImpl implements ApiOrderService {

    @Autowired
    private ApiOrderMapper orderMapper;

    @Autowired
    private ApiUserMapper userMapper;

    @Autowired
    private ApiStoreMapper storeMapper;

    @Autowired
    private ParaMapper paraMapper;

    @Override
    public Result SellerOrderList(Response<OrderInfoRes> response) throws Exception{
        Result rt = new Result();
        try {
            OrderInfoRes data = response.getData(OrderInfoRes.class);
            ApiSessionUser sessionUser = ServletHelper.getSessionUserByToken(response.getToken());
            if(sessionUser == null){
                rt.setStatus(EnumConfig.S_CODE.NOT_USER);
                return rt;
            }
            //rt.setData(store);
            rt.setStatus(EnumConfig.S_CODE.OK);

        }catch(Exception ex){
            rt.setStatus(EnumConfig.S_CODE.FAIL);
            throw  ex;
        }
        return rt;
    }

    @Override
    public Result BuyerOrderList(Response<OrderInfoRes> response) throws Exception{
        Result rt = new Result();
        try {
            OrderInfoRes data = response.getData(OrderInfoRes.class);
            ApiSessionUser sessionUser = ServletHelper.getSessionUserByToken(response.getToken());
            if(sessionUser == null){
                rt.setStatus(EnumConfig.S_CODE.NOT_USER);
                return rt;
            }
            //rt.setData(store);
            rt.setStatus(EnumConfig.S_CODE.OK);

        }catch(Exception ex){
            rt.setStatus(EnumConfig.S_CODE.FAIL);
            throw  ex;
        }
        return rt;
    }

    @Override
    public Result BuyerOrderAdd(Response<OrderRes> response) throws Exception {
        return null;
    }

    @Override
    public Result BuyerOrderCancel(Response<OrderRes> response) throws Exception {
        return null;
    }

    @Override
    public Result BuyerOrderDel(Response<OrderRes> response) throws Exception {
        return null;
    }

    @Override
    public Result BuyerOrderDelete(Response<OrderRes> response) throws Exception {
        return null;
    }

    @Override
    public Result BuyerOrderRec(Response<OrderRes> response) throws Exception {
        return null;
    }

    @Override
    public Result BuyerOrderDetail(Response<OrderRes> response) throws Exception {
        return null;
    }

    @Override
    public Result BuyerOrderRefunds(Response<OrderRes> response) throws Exception {
        return null;
    }

    @Override
    public Result BuyerOrderRefundsDetail(Response<OrderRes> response) throws Exception {
        return null;
    }

    @Override
    public Result BuyerOrderReturn(Response<OrderRes> response) throws Exception {
        return null;
    }

    @Override
    public Result BuyerOrderReceipt(Response<OrderRes> response) throws Exception {
        return null;
    }

    @Override
    public Result SellerOrderDeliver(Response<OrderRes> response) throws Exception {
        return null;
    }

    @Override
    public Result SellerOrderOut(Response<OrderRes> response) throws Exception {
        return null;
    }

    @Override
    public Result SellerOrderCancel(Response<OrderRes> response) throws Exception {
        return null;
    }

    @Override
    public Result SellerOrderDel(Response<OrderRes> response) throws Exception {
        return null;
    }

    @Override
    public Result SellerOrderDelete(Response<OrderRes> response) throws Exception {
        return null;
    }

    @Override
    public Result SellerOrderRec(Response<OrderRes> response) throws Exception {
        return null;
    }

    @Override
    public Result SellerOrderDetail(Response<OrderRes> response) throws Exception {
        return null;
    }

    @Override
    public Result SellerOrderReturnAudit(Response<OrderRes> response) throws Exception {
        return null;
    }

    @Override
    public Result SellerOrderRefundsAudit(Response<OrderRes> response) throws Exception {
        return null;
    }

    @Override
    public Result SellerOrderRefundsDetail(Response<OrderRes> response) throws Exception {
        return null;
    }
}
